package com.vencent.spring.root;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.springframework.web.WebApplicationInitializer;

import com.vencent.spring.filter.CrossFilter;
import com.vencent.spring.servlet.PicServlet;

public class RegisterServletAndFilter implements WebApplicationInitializer{

	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
		javax.servlet.FilterRegistration.Dynamic dyFilter = servletContext.addFilter("CrossFilter", CrossFilter.class);
		dyFilter.addMappingForUrlPatterns(null, false, "/*");
		
		javax.servlet.ServletRegistration.Dynamic dyServlet = servletContext.addServlet("PicServlet", PicServlet.class);
		dyServlet.addMapping("/");
	}

}
